package com.zygh.policeasset.controller;

import com.zygh.policeasset.component.CommonResult;
import com.zygh.policeasset.pojo.ShortcutMenu;
import com.zygh.policeasset.service.ShortcutMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping({"/shortcutMenu"})
@Api(tags = {"首页快捷菜单入口"})
@RestController
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/controller/ShortcutMenuController.class */
public class ShortcutMenuController {
    @Autowired
    ShortcutMenuService shortcutMenuService;

    @RequestMapping(value = {"/update"}, method = {RequestMethod.POST})
    @Transactional(rollbackFor = {Exception.class})
    @ApiOperation("修改")
    public Object updateName(@RequestBody List<ShortcutMenu> shortcutMenuList) {
        try {
            this.shortcutMenuService.delete();
            for (ShortcutMenu shortcutMenu : shortcutMenuList) {
                this.shortcutMenuService.add(shortcutMenu);
            }
            return new CommonResult().success();
        } catch (Exception e) {
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            e.printStackTrace();
            return new CommonResult().validateFailed(e.toString());
        }
    }
}